import type { PageParam, PageResult } from '@vben/request';

import { requestClient } from '#/api/request';

export namespace VenueBookingApi {
  /** 阵地预约信息 */
  export interface VenueBooking {
    id?: number;
    // TODO: 添加字段
  }

  /** 阵地预约分页查询参数 */
  export interface VenueBookingPageReqVO extends PageParam {
    createTime?: string[];
    // TODO: 添加查询条件字段
  }
}

/** 查询阵地预约分页 */
export function getVenueBookingPage(params: VenueBookingApi.VenueBookingPageReqVO) {
  return requestClient.get<PageResult<VenueBookingApi.VenueBooking>>(
    '/cmt/venue-booking/page',
    { params },
  );
}

/** 查询阵地预约详情 */
export function getVenueBooking(id: number) {
  return requestClient.get<VenueBookingApi.VenueBooking>(
    `/cmt/venue-booking/get?id=${id}`,
  );
}

/** 新增阵地预约 */
export function createVenueBooking(data: VenueBookingApi.VenueBooking) {
  return requestClient.post('/cmt/venue-booking/create', data);
}

/** 修改阵地预约 */
export function updateVenueBooking(data: VenueBookingApi.VenueBooking) {
  return requestClient.put('/cmt/venue-booking/update', data);
}

/** 删除阵地预约 */
export function deleteVenueBooking(id: number) {
  return requestClient.delete(`/cmt/venue-booking/delete?id=${id}`);
}

/** 批量删除阵地预约 */
export function deleteVenueBookingList(ids: number[]) {
  return requestClient.delete(
    `/cmt/venue-booking/delete-list?ids=${ids.join(',')}`,
  );
}

/** 导出阵地预约 */
export function exportVenueBooking(params: any) {
  return requestClient.download('/cmt/venue-booking/export-excel', { params });
}
